package com.zwb.demo.utils;

public class MyStringUtils {

    /**
     * 将字符串的首字母转大写
     */
    public static String capFirst(String str) {
        char[] ch = str.toCharArray();
        if ((ch[0] >= 'a') && (ch[0] <= 'z')) {
            ch[0] = ((char)(ch[0] - ' '));
        }
        return new String(ch);
    }
    /**
     * 将字符串的首字母转大写
     */
    public static String unCapFirst(String str) {
        char[] ch = str.toCharArray();
        if ((ch[0] >= 'A') && (ch[0] <= 'Z')) {
            ch[0] = ((char)(ch[0] + ' '));
        }
        return new String(ch);
    }


    public static void main(String[] args) {
        String xxxx = unCapFirst("XXXX");
        System.out.println(xxxx);
    }
}
